﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace Vue.Admin.Models
{
    public partial class DBContext : DbContext
    {
        public DBContext()
        {
        }

        public DBContext(DbContextOptions<DBContext> options)
            : base(options)
        {
        }

        public virtual DbSet<EBaseEmp> EBaseEmp { get; set; }
        public virtual DbSet<ESyEmpRoleMap> ESyEmpRoleMap { get; set; }
        public virtual DbSet<ESysMenu> ESysMenu { get; set; }
        public virtual DbSet<ESysRoles> ESysRoles { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseSqlServer("Server=.;Database=CodeIsBug_Test;user id=sa;password=123456;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("ProductVersion", "2.2.6-servicing-10079");

            modelBuilder.Entity<EBaseEmp>(entity =>
            {
                entity.HasKey(e => e.Fid);

                entity.ToTable("e_Base_Emp");

                entity.Property(e => e.Fid).HasColumnName("FID");

                entity.Property(e => e.FaddTime)
                    .HasColumnName("FAddTime")
                    .HasColumnType("datetime");

                entity.Property(e => e.Femail)
                    .HasColumnName("FEmail")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.FisDelete).HasColumnName("FIsDelete");

                entity.Property(e => e.FmodifyTime)
                    .HasColumnName("FModifyTime")
                    .HasColumnType("datetime");

                entity.Property(e => e.Fname)
                    .HasColumnName("FName")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Fphone)
                    .HasColumnName("FPhone")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Fpwd)
                    .HasColumnName("FPwd")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.FuserGuid).HasColumnName("FUserGuid");

                entity.Property(e => e.FuserName)
                    .HasColumnName("FUserName")
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ESyEmpRoleMap>(entity =>
            {
                entity.HasKey(e => e.Fid);

                entity.ToTable("e_Sy_EmpRoleMap");

                entity.Property(e => e.Fid).HasColumnName("FID");

                entity.Property(e => e.FempId).HasColumnName("FEmpID");

                entity.Property(e => e.FroleId).HasColumnName("FRoleID");
            });

            modelBuilder.Entity<ESysMenu>(entity =>
            {
                entity.HasKey(e => e.Fid);

                entity.ToTable("e_Sys_Menu");

                entity.Property(e => e.Fid).HasColumnName("FID");

                entity.Property(e => e.FaddTime).HasColumnName("FAddTime");

                entity.Property(e => e.Ficon).HasColumnName("FIcon");

                entity.Property(e => e.FisDeleted).HasColumnName("FIsDeleted");

                entity.Property(e => e.Flevel).HasColumnName("FLevel");

                entity.Property(e => e.Fname).HasColumnName("FName");

                entity.Property(e => e.FparentId).HasColumnName("FParentID");

                entity.Property(e => e.Fsort).HasColumnName("FSort");

                entity.Property(e => e.Furl).HasColumnName("FUrl");
            });

            modelBuilder.Entity<ESysRoles>(entity =>
            {
                entity.HasKey(e => e.Fid);

                entity.ToTable("e_Sys_Roles");

                entity.Property(e => e.Fid).HasColumnName("FID");

                entity.Property(e => e.FaddTime)
                    .HasColumnName("FAddTime")
                    .HasColumnType("datetime");

                entity.Property(e => e.FmodifyTime)
                    .HasColumnName("FModifyTime")
                    .HasColumnType("datetime");

                entity.Property(e => e.Fname)
                    .IsRequired()
                    .HasColumnName("FName")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.FparentId).HasColumnName("FParentID");

                entity.Property(e => e.Fremark)
                    .HasColumnName("FRemark")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.Fsort).HasColumnName("FSort");
            });
        }
    }
}
